<?php
class Cms_Permitsion_Acl extends Zend_Acl {
	public function __construct() {
		
		$this->addRole ( new Zend_Acl_Role ( "Guest" ) );
		$this->addRole ( new Zend_Acl_Role ( "Member" ), "Guest" );
		$this->addRole ( new Zend_Acl_Role ( "Admin" ), "Member" );
		$this->addRole ( new Zend_Acl_Role ( "SuperAdmin" ), "Admin" );
		
		
		//add cotroller to access
		$this->addResource ( "admin:index" );
		$this->addResource ( 'admin:error' );
		$this->addResource ( "admin:product" );
		$this->addResource ( "admin:category" );
		$this->addResource ( "admin:manufacture" );
		$this->addResource ( "admin:user" );
		$this->addResource ( "admin:groupuser" );
		$this->addResource ( "admin:constant" );
		$this->addResource ( "admin:upload" );
		$this->addResource ( "admin:order" );//quản lý đặt hàng
		$this->addResource ( "admin:advertisementcategory" );//mục quảng cáo
		$this->addResource ( "admin:advertisement" );//quảng cáo
		$this->addResource ( "admin:newscategory" );//phân loại tin tức
		$this->addResource ( "admin:news" );//quảng cáo
		$this->addResource ( "default:error" );
		$this->addResource ( "admin:websetting" ); 
		//permission 
		$this->allow ( "SuperAdmin", null, null );
		$this->allow ( "Admin", "admin:product", null );
		$this->allow ( "Admin", "admin:user", null );
		$this->allow ( "Admin", "admin:index", null );
		$this->allow ( "Admin", "admin:error", null );
		$this->allow ( "Admin", "admin:constant", null );
		$this->allow ( "Admin", "admin:manufacture", null );
		$this->allow ( "Admin", "admin:upload", null );
		$this->allow ( "Admin", "admin:order", null );
		$this->allow ( "Admin", "admin:advertisementcategory", null );
		$this->allow ( "Admin", "admin:advertisement", null );
		$this->allow ( "Admin", "admin:websetting", null );
		$this->allow ( "Guest", "admin:user",'login');
		$this->allow ( "Guest", "admin:user", 'logout' );	
		$this->allow ( "Guest", "default:error", null );
	}
}
?>